﻿using System;
using Microsoft.Xna.Framework;

namespace OrganizedConfusion.Game_Objects
{
    public class Ramp : BaseObject
    {
        public bool IsFacingLeft = false;
        public Ramp()
        {
            type = BaseObject.OBJ_TYPE.OBJ_RAMPS;
        }

        public void Update(GameTime gametime)
        {
            // Nothing to update, I believe...
        }

        public override bool CheckCollision(BaseObject obj)
        {
            // TODO: Have player roll up/down when collided
            if (obj.Type != (int)OBJ_TYPE.OBJ_PLAYER)
                return false;

            Player user = (Player)obj;

            if ((obj.Position.X + obj.ImageDimensions.X) > Position.X && obj.Position.X < Position.X + ImageDimensions.X)
            {
                if ((obj.Position.Y + obj.ImageDimensions.Y) > Position.Y)
                {
                    user.Velocity = new Vector2(user.Velocity.X, 0.0f);
                    user.Position = new Vector2(user.Position.X, Position.Y - user.ImageDimensions.Y);
                    return true;
                }
            }

            return false;
        }
    }
}
